package com.xs.springagain2.Dao;

import com.xs.springagain2.config.DataSourceConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

@Component
public class UserDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public int insertUser()  {
        String addSql = "insert into library (title,number,momey) values (?,?,?)";
        int add = jdbcTemplate.update(addSql, "springAgain", 99, 100);
        System.out.println("插入成功");
        return add;
    }
}
